package web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import biz.domain.User;
import biz.service.UserService;

@Controller
public class LoginController {

	@Autowired
	UserService userService;
	
	@RequestMapping(value="/", method=RequestMethod.GET)
	public String login(){
		return "index";
	}
	
	@RequestMapping(value="/", method=RequestMethod.POST)
	public String main(User user){
		System.out.print(user.getName());
		System.out.print(user.getPass());		
		boolean loginFlag = userService.findUser(user);
		if(loginFlag){
			return "main";
		}
		return "index";
	}
	
}
